Skip to content

Lambe 0.6.1: completer trailing-whitespace fix; rumil 0.6.0 dep bump#2

Merged
hakimjonas merged 1 commit into
mainfrom
fix/completer-trailing-whitespace
Apr 30, 2026
Merged

Lambe 0.6.1: completer trailing-whitespace fix; rumil 0.6.0 dep bump#2
hakimjonas merged 1 commit into
mainfrom
fix/completer-trailing-whitespace

Conversation

@hakimjonas
Copy link
Copy Markdown
Owner

@hakimjonas hakimjonas commented Apr 30, 2026

Fixes the tab-completion corruption where trailing whitespace in the REPL (or the arda-web playground) produced a wrong replacement offset. Typing .dependencies, a space, then Tab now completes against .dependencies instead of producing ..dependencies.

Completer changes (lib/src/completer.dart):

  • Unparsed-remainder classification no longer uses regex. Two small Rumil parsers (_pipeCtx, _fieldTailCtx) handle pipe-op and field-tail contexts, with position() for offset tracking.
  • AST-end offset (astEnd) is computed by walking back over trailing whitespace in the successfully-parsed prefix. Previously before.length was used directly, which overshoots when the user has typed trailing whitespace.
  • Whitespace handling is now uniform across space, tab, CR, LF.

Tests:

  • New 14-test Trailing whitespace regression group in test/completer_test.dart covering identity tails, field tails, access tails, parameterized ops, pipe-op paths, and the no-trailing-whitespace parity cases.
  • Fixed two cursor positions in existing tests (21 and 19 instead of 22 and 20) to match the new contract.
  • 752 tests passing, no regressions.

Investigation artefacts:

  • PLAN_COMPLETER_WHITESPACE_FIX.md documents the characterization (9 scenarios, 4 hypothesized fix shapes) and the decision to use Rumil parsers over regex.
  • tool/probe_completer.dart is a diagnostic runner for the cases the plan enumerates.

Dependency bumps (pubspec.yaml):

  • rumil: ^0.5.0 -> ^0.6.0
  • rumil_parsers: ^0.5.0 -> ^0.6.0
  • rumil_expressions: ^0.5.0 -> ^0.6.0

Rumil 0.6.0 adds the position() primitive used by the completer fix.

Version metadata:

  • pubspec.yaml version 0.6.0 -> 0.6.1.
  • lib/src/_version.dart regenerated via dart run tool/gen_version.dart.
  • doc/lam.1.md front-matter updated, doc/lam.1 regenerated.
  • README.md and doc/getting-started.md: stale 0.5.0/0.6.0 version strings in example outputs updated.

Release gate: format, analyze --fatal-infos, dartdoc --dry-run, tests all clean.

Fixes the tab-completion corruption where trailing whitespace in the
REPL (or the arda-web playground) produced a wrong replacement
offset. Typing `.dependencies`, a space, then Tab now completes
against `.dependencies` instead of producing `..dependencies`.

Completer changes (lib/src/completer.dart):

- Unparsed-remainder classification no longer uses regex. Two small
  Rumil parsers (`_pipeCtx`, `_fieldTailCtx`) handle pipe-op and
  field-tail contexts, with `position()` for offset tracking.
- AST-end offset (`astEnd`) is computed by walking back over
  trailing whitespace in the successfully-parsed prefix. Previously
  `before.length` was used directly, which overshoots when the user
  has typed trailing whitespace.
- Whitespace handling is now uniform across space, tab, CR, LF.

Tests:

- New 14-test `Trailing whitespace regression` group in
  test/completer_test.dart covering identity tails, field tails,
  access tails, parameterized ops, pipe-op paths, and the
  no-trailing-whitespace parity cases.
- Fixed two cursor positions in existing tests (21 and 19 instead
  of 22 and 20) to match the new contract.
- 752 tests passing, no regressions.

Investigation artefacts:

- PLAN_COMPLETER_WHITESPACE_FIX.md documents the characterization
  (9 scenarios, 4 hypothesized fix shapes) and the decision to use
  Rumil parsers over regex.
- tool/probe_completer.dart is a diagnostic runner for the cases
  the plan enumerates.

Dependency bumps (pubspec.yaml):

- rumil: ^0.5.0 -> ^0.6.0
- rumil_parsers: ^0.5.0 -> ^0.6.0
- rumil_expressions: ^0.5.0 -> ^0.6.0

Rumil 0.6.0 adds the `position()` primitive used by the completer
fix.

Version metadata:

- pubspec.yaml version 0.6.0 -> 0.6.1.
- lib/src/_version.dart regenerated via `dart run tool/gen_version.dart`.
- doc/lam.1.md front-matter updated, doc/lam.1 regenerated.
- README.md and doc/getting-started.md: stale 0.5.0/0.6.0 version
  strings in example outputs updated.

Release gate: format, analyze --fatal-infos, dartdoc --dry-run, tests
all clean.

Note: Lambe 0.6.0 was tagged locally but not published to pub.dev.
The pub.dev jump is 0.5.0 -> 0.6.1; consumers will see the full
0.6.0 + 0.6.1 CHANGELOG entries on install.
@hakimjonas hakimjonas merged commit c627500 into main Apr 30, 2026
3 checks passed
@hakimjonas hakimjonas deleted the fix/completer-trailing-whitespace branch April 30, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant